from django.db import models

# Create your models here.



class OAuthUser(models):
    """
    微信登录用户数据
    """
    user = models.ForeignKey('users.User', on_delete=models.CASCADE, verbose_name='用户')
    openid = models.CharField(max_length=64, verbose_name='开放平台openid', db_index=True)
    public_openid=models.CharField(max_length=64, verbose_name='公众号openid', db_index=True)
    applet_openid=models.CharField(max_length=64, verbose_name='小程序openid', db_index=True)
    weixin_unionid = models.CharField(max_length=64, verbose_name='weixin_unionid', db_index=True)
    # auto_now_add 表示只有添加的时候，才会把当前时间戳修改作为字段的值
    create_time = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
    # auto_now 表示在添加、修改的时候，自动补充当前时间戳作为字段的值
    update_time = models.DateTimeField(auto_now=True, verbose_name='更新时间')

    class Meta:
        db_table = 'tb_oauth'
        verbose_name = '第三方登录数据'
        verbose_name_plural = verbose_name
